using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;

using Microsoft.MSE.Catalog.Module;

namespace Microsoft.MSE.Catalog.ServiceHost
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        private EventLogInstaller svcCatalogEventLogInstaller;
        private EventLogInstaller dbEventLogInstaller;

        public ProjectInstaller()
        {
            InitializeComponent();
            svcCatalogEventLogInstaller = new EventLogInstaller();
            svcCatalogEventLogInstaller.Source = "MSE6 Service Catalog";
            svcCatalogEventLogInstaller.Log = "MSE6";
            dbEventLogInstaller = new EventLogInstaller();
            dbEventLogInstaller.Source = "MSE6 DB";
            dbEventLogInstaller.Log = "MSE6";
            Installers.Add(svcCatalogEventLogInstaller);
            Installers.Add(dbEventLogInstaller);
        }

        public override void Install(System.Collections.IDictionary stateSaver) {
            base.Install(stateSaver);
            UrlAcl.ModifyReservation("http://+:8090/ServiceCatalog/", "Local System", false);
        }

        public override void Uninstall(System.Collections.IDictionary savedState) {
            base.Uninstall(savedState);
            try {
                UrlAcl.ModifyReservation("http://+:8090/ServiceCatalog/", "Local System", true);
            } catch (Exception) {
            }
        }

        private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
        {

        }
    }
}